#ifndef __THREAD__
#define __THREAD__

#include <thread>
#include <atomic>
#include "IUtility.h"
#include "ISysResources.h"
#include "IThreadPoolManager.h"
#include "IPacket.h"
#include "IContainer.h"

class CThread: public virtual IThread
{
INIT_CLASS_PRODUCT(CThread)
public:
	const bool Init(const void * pvdPara, char * pszMsgTxt, int iMsgTxtSize);
	const void UnInit();
	void Start();
	void Wait();
	void Stop();

private:
	long long m_llInterval, m_llThreadCount;
	IThreadPool * m_ptrThreadPool;
	shared_ptr<thread> m_ptrThread;
	shared_ptr<IWork> m_ptrWork;
	shared_ptr<ITrigger> m_ptrThreadStart;
	atomic<bool> m_bThreadStopFlg;
	HANDLE m_SignalHd[1];

private:
	void Execute();
};



#endif//__THREAD__